home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / freedos / freedos_docs / mini / emacs-tutorial.txt < prev    next >
Text File  |  2000-02-08  |  30KB  |  704 lines

  1. Copyright (c) 1985 Richard M. Stallman.  See end for copying conditions.
  2. Portions Copyright (c) 1986 Russell N. Nelson
  3.  
  4. You are looking at the Freemacs tutorial.
  5.  
  6. Freemacs commands generally involve the CONTROL key (sometimes labelled
  7. CTRL or CTL) or the META key (sometimes labelled ALT).  Rather than
  8. write out META or CONTROL each time we want you to prefix a character,
  9. we'll use the following abbreviations:
  10.  
  11.  C-<chr>  means hold the CONTROL key while typing the character <chr>
  12.           Thus, C-f would be: hold the CONTROL key and type f.
  13.  M-<chr>  means hold the META or ALT key down while typing <chr>.
  14.           If there is no META or ALT key, type <ESC>, release it,
  15.           then type the character <chr>.  "<ESC>" stands for the
  16.           key labelled ESC.
  17.  
  18. Important note: if you must exit at some point, type C-X C-C.
  19. The characters ">>" at the left margin indicate directions for you to
  20. try using a command.  For instance:
  21. >>  Now type C-v (View next screen) to move to the next screen.
  22.         (go ahead, do it by depressing the control key and v together).
  23.         From now on, you'll be expected to do this whenever you finish
  24.         reading the screen.
  25.  
  26. Note that there is an overlap when going from screen to screen; this
  27. provides some continuity when moving through the file.
  28.  
  29. The first thing that you need to know is how to move around from
  30. place to place in the file.  You already know how to move forward a
  31. screen, with C-v.  To move backwards a screen, type M-v (depress the
  32. META key and type v, or type <ESC>v if you don't have a META or ALT
  33. key).
  34.  
  35. >>  Try typing M-v and then C-v to move back and forth a few times.
  36.  
  37.  
  38. SUMMARY
  39. -------
  40.  
  41. The following commands are useful for viewing screenfuls:
  42.  
  43.         C-v     Move forward one screenful
  44.         M-v     Move backward one screenful
  45.         C-l     Clear screen and redisplay everything
  46.                  putting the text near the cursor at the center.
  47.                  (That's control-L, not control-1.)
  48.  
  49. >> Find the cursor and remember what text is near it.
  50.    Then type a C-l.
  51.    Find the cursor again and see what text is near it now.
  52.  
  53.  
  54. BASIC CURSOR CONTROL
  55. --------------------
  56.  
  57. Getting from screenful to screenful is useful, but how do you
  58. reposition yourself within a given screen to a specific place?
  59. There are several ways you can do this.  One way (not the best, but
  60. the most basic) is to use the commands previous, backward, forward
  61. and next.  As you can imagine these commands (which are given to
  62. Freemacs as C-p, C-b, C-f, and C-n  respectively) move the cursor from
  63. where it currently is to a new place in the given direction.  Here,
  64. in a more graphical form are the commands:
  65.  
  66.                           Previous line, C-p
  67.                                   :
  68.                                   :
  69.    Backward, C-b .... Current cursor position .... Forward, C-f
  70.                                   :
  71.                                   :
  72.                           Next line, C-n
  73.  
  74. >> Move the cursor to the line in the middle of that diagram
  75.    and type C-l to see the whole diagram centered in the screen.
  76.  
  77. You'll probably find it easy to think of these by letter.  P for
  78. previous, N for next, B for backward and F for forward.  These are
  79. the basic cursor positioning commands and you'll be using them ALL
  80. the time so it would be of great benefit if you learn them now.
  81.  
  82. >> Do a few C-n's to bring the cursor down to this line.
  83.  
  84. >> Move into the line with C-f's and then up with C-p's.
  85.    See what C-p does when the cursor is in the middle of the line.
  86.  
  87. Lines are separated by Newline characters.  For most applications
  88. there should normally be a Newline character at the end of the text,
  89. as well, but it is up to you to make sure of this.  A file can
  90. validly exist without a Newline at the end.
  91.  
  92. >> Try to C-b at the beginning of a line.  Do a few more C-b's.
  93.    Then do C-f's back to the end of the line and beyond.
  94.  
  95. When you go off the top or bottom of the screen, the text beyond
  96. the edge is shifted onto the screen so that your instructions can
  97. be carried out while keeping the cursor on the screen.
  98.  
  99. >> Try to move the cursor off the bottom of the screen with C-n and
  100.    see what happens.
  101.  
  102. If moving by characters is too slow, you can move by words.  M-f
  103. (Meta-f) moves forward a word and M-b moves back a word.
  104.  
  105. >> Type a few M-f's and M-b's.  Intersperse them with C-f's and C-b's.
  106.  
  107. Notice the parallel between C-f and C-b on the one hand, and M-f and
  108. M-b on the other hand.  Very often Meta characters are used for
  109. operations related to English text whereas Control characters operate
  110. on the basic textual units that are independent of what you are
  111. editing (characters, lines, etc).  There is a similar parallel between
  112. lines and sentences: C-a and C-e move to the beginning or end of a
  113. line, and M-a and M-e move to the beginning or end of a sentence.
  114.  
  115. >> Try a couple of C-a's, and then a couple of C-e's.
  116.    Try a couple of M-a's, and then a couple of M-e's.
  117.  
  118. See how repeated C-a's do nothing, but repeated M-a's keep moving
  119. farther.  Do you think that this is right?
  120.  
  121. Two other simple cursor motion commands are M-< (Meta Less-than),
  122. which moves to the beginning of the file, and M-> (Meta Greater-than),
  123. which moves to the end of the file.  You probably don't need to try
  124. them, since finding this spot again will be boring.  On most terminals
  125. the "<" is above the comma and you must use the shift key to type it.
  126. On these terminals you must use the shift key to type M-< also;
  127. without the shift key, you would be typing M-comma.
  128.  
  129. The location of the cursor in the text is also called "point".  To
  130. paraphrase, the cursor shows on the screen where point is located in
  131. the text.
  132.  
  133. Here is a summary of simple moving operations including the word and
  134. sentence moving commands:
  135.  
  136.         C-f     Move forward a character
  137.         C-b     Move backward a character
  138.  
  139.         M-f     Move forward a word
  140.         M-b     Move backward a word
  141.  
  142.         c-n     Move to next line
  143.         C-p     Move to previous line
  144.  
  145.         C-a     Move to beginning of line
  146.         C-e     Move to end of line
  147.  
  148.         M-a     Move back to beginning of sentence
  149.         M-e     Move forward to end of sentence
  150.  
  151.         M-<     Go to beginning of file
  152.         M->     Go to end of file
  153.  
  154. >> Try all of these commands now a few times for practice.
  155.    Since the last two will take you away from this screen,
  156.    you can come back here with M-v's and C-v's.  These are
  157.    the most often used commands.
  158.  
  159. Like all other commands in Freemacs, these commands can be given
  160. arguments which cause them to be executed repeatedly.  The way you
  161. give a command a repeat count is by typing C-u and then the digits
  162. before you type the command.  If you have a META or ALT key, you can
  163. omit the C-u if you hold down the META or ALT key while you type the
  164. digits.  This is easier, but we recommend the C-u method because it
  165. works on any terminal.
  166.  
  167. For instance, C-u 8 C-f moves forward eight characters.
  168.  
  169. >> Try giving a suitable argument to C-n or C-p to come as close
  170.    as you can to this line in one jump.
  171.  
  172. The only apparent exception to this is the screen moving commands,
  173. C-v and M-v.  When given an argument, they scroll the screen up or
  174. down by that many lines, rather than screenfuls.  This proves to be
  175. much more useful.
  176.  
  177. >> Try typing C-u 8 C-v now.
  178.  
  179. Did it scroll the screen up by 8 lines?  If you would like to
  180. scroll it down you can give an argument to M-v.
  181.  
  182.  
  183. WHEN EMACS IS HUNG
  184. -----------------
  185.  
  186. If Freemacs gets into an infinite (or simply very long) computation which
  187. you don't want to finish, you can stop it safely by typing C-g.
  188. You can also use C-g to discard a numeric argument or the beginning of
  189. a command that you don't want to finish.
  190.  
  191. >> Type C-u 100 to make a numeric arg of 100, then type C-g.
  192.    Now type C-f.  How many characters does it move?
  193.    If you have typed an <ESC> by mistake, you can get rid of it
  194.    with a C-g.
  195.  
  196.  
  197. WINDOWS
  198. -------
  199.  
  200. Freemacs can have two windows, each displaying its own text.
  201. At this stage it is better not to go into the techniques of
  202. using multiple windows.  But you do need to know how to get
  203. rid of extra windows that may appear to display help or
  204. output from certain commands.  It is simple:
  205.  
  206.         C-x 1   One window (i.e., kill the other window).
  207.  
  208. That is Control-x followed by the digit 1.
  209. C-x 1 makes the window which the cursor is in become
  210. the full screen, by getting rid of the other window, if any.
  211.  
  212. >> Type C-x 2 and see this buffer displayed in two windows.
  213.  
  214. >> Type C-x 1 and see the lower window disappear.
  215.  
  216.  
  217. INSERTING AND DELETING
  218. ----------------------
  219.  
  220. If you want to insert text, just type it.  Characters which you can
  221. see, such as A, 7, *, etc. are taken by Freemacs as text and inserted
  222. immediately.  Type <Return> (the carriage-return key) to insert a
  223. Newline character.
  224.  
  225. You can delete the last character you typed by typing <Backspace>.
  226. More generally, <Backspace> deletes the character immediately before
  227. the current cursor position.
  228.  
  229. >> Do this now, type a few characters and then delete them
  230.    by typing <Backspace> a few times.  Don't worry about this file
  231.    being changed; you can abandon the changes later.
  232.  
  233. >> Now start typing text until you reach the right margin, and keep
  234.    typing.  When a line of text gets too big for one line on the
  235.    screen, the screen scrolls left so that the cursor remains on the
  236.    screen.
  237.  
  238. >> Use <Backspace>s to delete the text until the line fits on one screen
  239.    again.
  240.  
  241. >> Move the cursor to the beginning of a line and type <Backspace>.  This
  242.    deletes the newline before the line and merges the line onto
  243.    the previous line.  The resulting line may be too long to fit, in
  244.    which case you will see a small arrow pointing right, off the screen.
  245. >> Type <Return> to reinsert the Newline you deleted.
  246.  
  247. Remember that most Freemacs commands can be given a repeat count;
  248. this includes characters which insert themselves.
  249.  
  250. >>  Try that now -- type C-u 8 * and see what happens.
  251.  
  252. You've now learned the most basic way of typing something in
  253. Freemacs and correcting errors.  You can delete by words or lines
  254. as well.  Here is a summary of the delete operations:
  255.  
  256.         <Backspace>    delete the character just before the cursor
  257.         C-d            delete the next character after the cursor
  258.  
  259.         M-<Backspace>  kill the word immediately before the cursor
  260.         M-d            kill the next word after the cursor
  261.  
  262.         C-k            kill from the cursor position to end of line
  263.         M-k            kill to the end of the current sentence
  264.  
  265. Notice that <Backspace> and C-d vs M-<Backspace> and M-d extend the parallel
  266. started by C-f and M-f (well, <Backspace> isn't really a control
  267. character, but let's not worry about that).  C-k and M-k are like C-e
  268. and M-e, sort of, in that lines are opposite sentences.
  269.  
  270. Now suppose you kill something, and then you decide that you want to
  271. get it back?  Well, whenever you kill something bigger than a
  272. character, Freemacs saves it for you.  To yank it back, use C-y.  You
  273. can kill text in one place, move elsewhere, and then do C-y; this is
  274. a good way to move text around.  Note that the difference
  275. between "Killing" and "Deleting" something is that "Killed" things
  276. can be yanked back, and "Deleted" things cannot.  Generally, the
  277. commands that can destroy a lot of text save it, while the ones that
  278. attack only one character, or nothing but blank lines and spaces, do
  279. not save.
  280.  
  281. For instance, type C-n a couple times to postion the cursor
  282. at some line on this screen.
  283.  
  284. >> Do this now, move the cursor and kill that line with C-k.
  285.  
  286. Note that a single C-k kills the contents of the line, and a second
  287. C-k kills the line itself, and make all the other lines move up.  If
  288. you give C-k a repeat count, it kills that many lines AND their
  289. contents.
  290.  
  291. The text that has just disappeared is saved so that you can
  292. retrieve it.  To retrieve the last killed text and put it where
  293. the cursor currently is, type C-y.
  294.  
  295. >> Try it; type C-y to yank the text back.
  296.  
  297. Think of C-y as if you were yanking something back that someone
  298. took away from you.  Notice that if you do several C-k's in a row
  299. the text that is killed is all saved together so that one C-y will
  300. yank all of the lines.
  301.  
  302. >> Do this now, type C-k several times.
  303.  
  304. Now to retrieve that killed text:
  305.  
  306. >> Type C-y.  Then move the cursor down a few lines and type C-y
  307.    again.  You now see how to copy some text.
  308.  
  309. What do you do if you have some text you want to yank back, and then
  310. you kill something else?  C-y would yank the more recent kill.  But
  311. the previous text is not lost.  You can get back to it using the M-y
  312. command.  After you have done C-y to get the most recent kill, typing
  313. M-Y replaces that yanked text with the previous kill.  Typing M-y
  314. again and again brings in earlier and earlier kills.  When you
  315. have reached the text you are looking for, you can just go away and
  316. leave it there.  If you M-y enough times, you come back to the
  317. starting point (the most recent kill).
  318.  
  319. >> Kill a line, move around, kill another line.
  320.    Then do C-y to get back the second killed line.
  321.    Then do M-y and it will be replaced by the first killed line.
  322.    Do more M-y's and see what you get.  Keep doing them until
  323.    the second kill line comes back, and then a few more.
  324.  
  325.  
  326. FILES
  327. -----
  328.  
  329. In order to make the text you edit permanent, you must put it in a
  330. file.  Otherwise, it will go away when your invocation of Freemacs goes
  331. away.  You put your editing in a file by "finding" the file.  What
  332. finding means is that you see the contents of the file in your Freemacs;
  333. and, loosely speaking, what you are editing is the file itself.
  334. However, the changes still don't become permanent until you "save" the
  335. file.  This is so you can have control to avoid leaving a half-changed
  336. file around when you don't want to.  Even then, Freemacs can leave the
  337. original file under a changed name in case your changes turn out
  338. to be a mistake.
  339.  
  340. If you look near the bottom of the screen you will see a line that begins
  341. with the string "EMACS (Fundamental) 3: teach.doc".  Your copy of the
  342. Freemacs tutorial is called "teach.doc".  Whatever file you find, that
  343. file's name will appear in that precise spot.
  344.  
  345. The commands for finding and saving files are unlike the other
  346. commands you have learned in that they consist of two characters.
  347. They both start with the character Control-x.  There is a whole series
  348. of commands that start with Control-x; many of them have to do with
  349. files, buffers, and related things, and all of them consist of
  350. Control-x followed by some other character.
  351.  
  352. Another thing about the command for finding a file is that you have
  353. to say what file name you want.  We say the command "reads an argument
  354. from the terminal" (in this case, the argument is the name of the
  355. file).  After you type the command
  356.  
  357.         C-x C-f   Find a file
  358.  
  359. Freemacs asks you to type the file name.  It echoes on the bottom
  360. line of the screen.  You are using the minibuffer now!  this is
  361. what the minibuffer is for.  When you type <Return> to end the
  362. file name, the minibuffer is no longer needed, so it disappears.
  363.  
  364. >> Type C-x C-f, then type C-g and C-g.  This cancels the minibuffer,
  365.    and also cancels the C-x C-f command that was using the
  366.    minibuffer.  So you do not find any file.
  367.  
  368. In a little while the file contents appear on the screen.  You can
  369. edit the contents.  When you wish to make the changes permanent,
  370. issue the command
  371.  
  372.         C-x C-s   Save the file
  373.  
  374. The contents of Freemacs are written into the file.  You should save
  375. fairly often, so that you will not lose very much work if the system
  376. should crash.
  377.  
  378. >> Type C-x C-s, saving your copy of the tutorial.
  379.  
  380. To make a new file, just find it "as if" it already existed.  Then
  381. start typing in the text.  When you ask to "save" the file, Freemacs
  382. will really create the file with the text that you have inserted.
  383. >From then on, you can consider yourself to be editing an already
  384. existing file.
  385.  
  386.  
  387. BUFFERS
  388. -------
  389.  
  390. If you find a second file with C-x C-f, the first file remains
  391. inside Freemacs.  You can switch back to it by finding it again with
  392. C-x C-f.  This way you can get quite a number of files inside Freemacs.
  393.  
  394. The object inside Freemacs which holds the text read from one file
  395. is called a "buffer."  Finding a file makes a new buffer inside Freemacs.
  396. To see a list of the buffers that exist in Freemacs, type
  397.  
  398.         C-x C-b   List buffers
  399.  
  400. >> Try C-x C-b now.
  401.  
  402. See how each buffer has a name, and it may also have a file name
  403. for the file whose contents it holds.  Only those buffers that say FILE
  404. were loaded by yourself.  Any other buffers were created by Freemacs,
  405. with the exception of Main.
  406.  
  407. >> Type Space to get rid of the buffer list.
  408.  
  409. If you make changes to the text of one file, then find another file,
  410. this does not save the first file.  Its changes remain inside Freemacs,
  411. in that file's buffer.  The creation or editing of the second file's
  412. buffer has no effect on the first file's buffer.  This is very useful,
  413. but it also means that you need a convenient way to save the first
  414. file's buffer.  It would be a nuisance to have to switch back to
  415. it with C-x C-f in order to save it with C-x C-s.  So we have
  416.  
  417.         C-x C-m   Write modified files
  418.  
  419. C-x C-m goes through the list of all the buffers you have
  420. and finds the ones that contain files you have changed, and
  421. saves them.
  422.  
  423.  
  424. EXTENDING THE COMMAND SET
  425. -------------------------
  426.  
  427. There are many, many more Freemacs commands than could possibly be put
  428. on all the control and meta characters.  Freemacs gets around this with
  429. the X (eXtend) command.  This comes in two flavors:
  430.  
  431.         C-x     Character eXtend.  Followed by one character.
  432.         M-x     Named command eXtend.  Followed by a long name.
  433.  
  434. These are commands that are generally useful but used less than the
  435. commands you have already learned about.  You have already seen two
  436. of them: the file commands C-x C-f to Find and C-x C-s to Save.
  437. Another example is the command to tell Freemacs that you'd like to stop
  438. editing and get rid of Freemacs.  The command to do this is C-x C-c.
  439. (Don't worry; it offers to save each changed file before it kills
  440. Freemacs.)
  441.  
  442. C-x C-z is the usual way to exit Freemacs, because it is always better not
  443. to kill the Freemacs if you are going to do any more editing.  C-x C-z
  444. creates a subshell running under Freemacs to give you the chance to run
  445. other programs and return to Freemacs afterward, but it does not truly
  446. "exit" from Freemacs.  To return to Freemacs, use "exit".
  447.  
  448. There are many C-x commands.  The ones you know are:
  449.  
  450.         C-x C-f         Find file.
  451.         C-x C-s         Save file.
  452.         C-x C-b         List buffers.
  453.         C-x C-c         Quit Freemacs.
  454.  
  455. Named eXtended commands are commands which are used even less frequently,
  456. or commands which are used only in certain modes.  These commands are
  457. usually called "functions".  An example is the function query-replace,
  458. which globally replaces one string with another.  When you type M-x,
  459. Freemacs prompts you at the bottom of the screen with M-x and you should
  460. type the name of the function you wish to call; in this case,
  461. "query-replace".  Just type "que " and Freemacs will complete the name.
  462. Then type the two "arguments"--the string to be replaced, and the string
  463. to replace it with--each one ended with a Return.
  464.  
  465. >> Move the cursor to the blank line two lines below this one.
  466.    Then type M-x que<Return>changed<Return>altered<Return>!.
  467.  
  468.    Notice how this line has changed: you've replaced
  469.    the word c-h-a-n-g-e-d with "altered" wherever it occured
  470.    after the cursor.
  471.  
  472.  
  473. MODE LINE
  474. ---------
  475.  
  476. Freemacs shows the commands that you are typing at the bottom of the
  477. screen in an area called the "echo area."  The echo area contains the
  478. bottom line of the screen.  The line immediately above it is called the
  479. MODE LINE.  The mode line says something like
  480.  
  481. -----Emacs:2: c:\emacs\tutorial.doc [FILE] (Text) C44 L481/736 --67--
  482.  
  483. This is a very useful "information" line.
  484.  
  485. You already know what the filename means--it is the file you have found.
  486. [FILE] means that this is a file that you have found, as opposed to one
  487. created by Freemacs.  What the C44 L481/736 means is that you are at
  488. column 44 and line 481 of a file that is 736 lines long.
  489.  
  490. The dashes at the left will contain stars if you have made changes to the
  491. text.  Right after you visit or save a file, there are no stars.
  492.  
  493. The part of the mode line inside the parentheses is to tell you what modes
  494. you are in.  The default mode is Fundamental.  Since this is a text file,
  495. the mode is "Text".  It is an example of a "major mode".  There are
  496. several major modes in Freemacs for editing different languages and text,
  497. such as Mint mode, C mode, etc.  At any time one and only one major mode
  498. is active, and its name can always be found in the mode line just where
  499. "Text" is now.
  500.  
  501. Each major mode makes a few commands behave differently.  For example,
  502. there are commands for creating comments in a program, and since each
  503. programming language has a different idea of what a comment should look
  504. like, each major mode has to insert comments differently.  Each major mode
  505. is the name of an extended command, which is how you get into the mode.
  506. For example, M-X Fun-mode is how to get into Fundamental mode.  Other
  507. modes have the word mode in their names.
  508.  
  509. If you are going to be editing English text, such as this file, you
  510. should probably use Text Mode.
  511. >> Type M-x Text-mode<Return>.
  512.  
  513. Don't worry, none of the commands you have learned changes Freemacs in any
  514. great way.  Major modes are usually like that: commands don't change into
  515. completely unrelated things, but they work a little bit differently.
  516.  
  517. Major modes are called major because there are also minor modes.
  518. They are called minor because they aren't alternatives to the major
  519. modes, just minor modifications of them.  Each minor mode can be
  520. turned on or off by itself, regardless of what major mode you are in,
  521. and regardless of the other minor modes.  So you can use no minor
  522. modes, or one minor mode, or any combination of several minor modes.
  523.  
  524. One minor mode which is very useful, especially for editing English
  525. text, is Auto Fill mode.  When this mode is on, Freemacs breaks the line
  526. in between words automatically whenever the line gets too long.  You
  527. can turn this mode on by doing M-x auto-fill-mode<Return>.  When the
  528. mode is on, you can turn it off by doing M-x auto-fill-mode<Return>.
  529. If the mode is off, this function turns it on, and if the mode is on,
  530. this function turns it off.  This is called "toggling".
  531.  
  532. >> Type M-x auto-fill-mode<Return> now.  Then insert a line of "asdf "
  533.    over again until you see it divide into two lines.  You must put in
  534.    spaces between them because Auto Fill breaks lines only at spaces.
  535.  
  536. The margin is usually set at 70 characters, but you can change it
  537. with the C-x f command.  You should give the margin setting you want
  538. as a numeric argument.
  539.  
  540. >> Type C-x f with an argument of 20.  (C-u 2 0 C-x f).
  541.    Then type in some text and see Freemacs fill lines of 20
  542.    characters with it.  Then set the margin back to 70 using
  543.    C-x f again.
  544.  
  545. If you makes changes in the middle of a paragraph, Auto Fill mode
  546. does not re-fill it for you.
  547. To re-fill the paragraph, type M-q
  548. (Meta-q) with the cursor inside that paragraph.
  549.  
  550. >> Move the cursor into the previous paragraph and type M-q.
  551.  
  552. SEARCHING
  553. ---------
  554.  
  555. Freemacs can do searches for strings (these are groups of contiguous
  556. characters or words) either forward through the file or backward
  557. through it.  To search for the string means that you are trying to
  558. locate it somewhere in the file and have Freemacs show you where the
  559. occurrences of the string exist.  This type of search is somewhat
  560. different from what you may be familiar with.  It is a search that is
  561. performed as you type in the thing to search for.  The command to
  562. initiate a search is C-s for forward search, and C-r for reverse
  563. search.  BUT WAIT!  Don't do them now.  When you type C-s you'll
  564. notice that the string "I-search" appears as a prompt in the echo
  565. area.  This tells you that Freemacs is in what is called an incremental
  566. search waiting for you to type the thing that you want to search for.
  567. <Return> terminates a search.
  568.  
  569. >> Now type C-s to start a search.  SLOWLY, one letter at a time,
  570.    type the word 'cursor', pausing after you type each
  571.    character to notice what happens to the cursor.
  572. >> Type C-s to find the next occurrence of "cursor".
  573. >> Now type <Backspace> four times and see how the cursor moves.
  574. >> Type <Return> to terminate the search.
  575.  
  576. Did you see what happened?  Freemacs, in an incremental search, tries to
  577. go to the occurrence of the string that you've typed out so far.  To go
  578. to the next occurrence of 'cursor' just type C-s again.  If no such
  579. occurrence exists Freemacs beeps and tells you that it is a failing
  580. search.  C-g would also terminate the search.
  581.  
  582. If you are in the middle of an incremental search and type <Backspace>,
  583. you'll notice that the last character in the search string is erased
  584. and the search backs up to the last place of the search.  For
  585. instance, suppose you currently have typed 'cu' and you see that your
  586. cursor is at the first occurrence of 'cu'.  If you now type <Backspace>,
  587. the 'u' on the search line is erased and you'll be repositioned in the
  588. text to the occurrence of 'c' where the search took you before you
  589. typed the 'u'.  This provides a useful means for backing up while you
  590. are searching.
  591.  
  592. If you are in the middle of a search and happen to type a control
  593. character (other than a C-s or C-r, which tell Freemacs to search for the
  594. next occurrence of the string), the search is terminated.
  595.  
  596. The C-s starts a search that looks for any occurrence of the search
  597. string AFTER the current cursor position.  But what if you want to
  598. search for something earlier in the text?  To do this, type C-r for
  599. Reverse search.  Everything that applies to C-s applies to C-r except
  600. that the direction of the search is reversed.
  601.  
  602.  
  603. GETTING MORE HELP
  604. -----------------
  605.  
  606. The Help system hasn't been written yet.  Any takers?
  607.  
  608. In this tutorial we have tried to supply just enough information to get
  609. you started using Freemacs.  There is so much available in Freemacs that
  610. it would be impossible to explain it all here.  However, you may want to
  611. learn more about Freemacs since it has numerous desirable features that
  612. you don't know about yet.  Freemacs has a great deal of internal
  613. documentation.  All of these commands can be accessed through the key F1,
  614. which we call "the Help character" or <HELP> because of the function it
  615. serves.
  616.  
  617. To use the HELP features, type the <HELP> character, and then a
  618. character saying what kind of help you want.  If you are REALLY lost,
  619. type <HELP> ? and Freemacs will tell you what kinds of help it can give.
  620. If you have typed <HELP> and decide you don't want any help, just
  621. type C-G to cancel it.
  622.  
  623. The most basic HELP feature is <HELP> c.  Type <HELP>, a c, and a
  624. command character or sequence, and Freemacs displays a very brief
  625. description of the command.
  626.  
  627. >> Type <HELP> c Control-p.
  628.   The message should be something like
  629.  
  630.         C-p is previous-line
  631.  
  632. This tells you the "name of the function".  That is important in
  633. writing Lisp code to extend Freemacs; it also is enough to remind
  634. you of what the command does if you have seen it before but did
  635. not remember.
  636.  
  637. Multi-character commands such as C-x C-s and (if you have no META or
  638. ALT key) <ESC>v are also allowed after <HELP> c.
  639.  
  640. To get more information on the command, use <HELP> k instead of <HELP> c.
  641.  
  642. >> Type <HELP> k Control-p.
  643.  
  644. This displays the documentation of the function, as well as its name,
  645. at the top of the screen.  Press a key to
  646. continue, only space will be discarded...
  647.  
  648. Here are some other useful <HELP> options:
  649.  
  650.    <HELP> f     Describe a function.  You type in the name of the
  651.                 function.
  652.  
  653. >> Try typing <HELP> f previous-line<Return>.
  654.    This prints all the information Freemacs has about the
  655.    function which implements the C-P command.
  656.  
  657.    <HELP> a     Apropos.  Type in a keyword and Freemacs will list
  658.                 all the commands whose names contain that keyword.
  659.                 These commands can all be invoked with Meta-x.
  660.                 For some commands, Apropos will also list a one
  661.                 or two character sequence which has the same effect.
  662.  
  663. >> Type <HELP> a file<Return>.  You will see a list of all M-x commands
  664. with "file" in their names.  You will also see commands
  665. like C-x C-f and C-x C-w, listed beside the command names
  666. find-file and write_file.
  667.  
  668.  
  669. CONCLUSION
  670. ----------
  671.  
  672. Remember, to exit Freemacs permanently use C-x C-c.  To exit to a shell
  673. temporarily, so that you can come back in, use C-x C-z.
  674.  
  675. This tutorial is meant to be understandable to all new users, so if
  676. you found something unclear, don't sit and blame yourself - complain!
  677.  
  678.  
  679. COPYING
  680. -------
  681.  
  682. This tutorial, like all of Freemacs, is copyrighted, and comes with
  683. permission to distribute copies on certain conditions:
  684.  
  685. Copyright (c) 1985 Richard M. Stallman
  686.  
  687.    Permission is granted to anyone to make or distribute verbatim copies
  688.    of this document as received, in any medium, provided that the
  689.    copyright notice and permission notice are preserved,
  690.    and that the distributor grants the recipient permission
  691.    for further redistribution as permitted by this notice.
  692.  
  693.    Permission is granted to distribute modified versions
  694.    of this document, or of portions of it,
  695.    under the above conditions, provided also that they
  696.    carry prominent notices stating who last altered them.
  697.  
  698. The conditions for copying Freemacs itself are slightly different
  699. but in the same spirit.  Please read the file LICENSE and then
  700. do give copies of Freemacs to your friends.
  701. Help stamp out ownership of software by using, writing,
  702. and sharing free software!
  703.  
  704.